package mr.ali.videoapp.portal.controller;

import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import mr.ali.videoapp.portal.Exception.R;
import mr.ali.videoapp.portal.model.Actor;
import mr.ali.videoapp.portal.service.IActorService;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
@RestController
@RequestMapping("/portal/actor")
@Slf4j
public class ActorController {

    @Resource
    private RedisTemplate redisTemplate;

    @Resource
    private IActorService actorService;


    /**
     * collection演员列表
     */
    @GetMapping("/collection")
    public PageInfo<Actor> collection(Integer pageNum, Integer pageSize, Integer sort, Integer gender) {
        PageInfo<Actor> actorList = actorService.getActorList(pageNum, pageSize, sort, gender);
        return actorList;
    }

    /**
     * collection演员信息
     */
    @GetMapping("/collection/getActorById")
    public R<Actor> getActorById(Integer id) {
        Actor actor = actorService.getActorInfo(id);
        return R.ok(actor);
    }



}
